package bill.study.javaPuzzlers.classy;

import java.util.Calendar;


/**
 * 
 * 
 * Class initialization order:
 * 1. static fields are set their default values
 * 2.static field initializers are executed in order of appearance.
 * 
 * Recursive initialization attempts are simply ignored.
 * Final fields are constants only if the initializing expression is a constant expression.
 * 
 * @author yangliu
 *
 */
public class Elvis {
	public static final Elvis INSTANCE = new Elvis();
	private final int beltSize;
	private static final int CURRENT_YEAR = Calendar.getInstance().get(
			Calendar.YEAR);

	private Elvis() {
		this.beltSize = CURRENT_YEAR - 1930;
	}

	public int beltSize() {
		return this.beltSize;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.println("Elvis wears a size " + INSTANCE.beltSize
				+ " belts. ");
	}

}
